package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.ui.Multitouch;
	import flash.ui.MultitouchInputMode;
	
	import starling.core.Starling;
	
//	[SWF(frameRate="60",width="800",height="480",backgroundColor="0xdfdfdd")]
	[SWF(frameRate="60",width="960",height="640",backgroundColor="0xdfdfdd")]
	public class HungryHeroMobile extends Sprite
	{
		
		private var stats:Stats;
		private var myStarling:Starling;

		public static var txt:TextField;
		
		public function HungryHeroMobile()
		{
			this.addEventListener(Event.ADDED_TO_STAGE,addToStage);
		}			
		
		protected function addToStage(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE,addToStage);
			
			
			txt = new TextField();
			txt.text = "正在加载....";
			
			txt.x = stage.stageWidth * 0.5;
			txt.y = stage.stageHeight * 0.5;
			addChild(txt);
			
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stats = new Stats();
			this.addChild(stats);
			Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
			this.addEventListener(Event.ENTER_FRAME,efHandler);
		}
		
		protected function efHandler(event:Event):void
		{
			if(stage.stageHeight>=stage.fullScreenHeight && myStarling==null){
				this.removeEventListener(Event.ENTER_FRAME,efHandler);
				myStarling = new Starling(Game, stage);
				myStarling.antiAliasing = 1;
				myStarling.start();
				
			}
		}
	}
}
